Skip to content

fix(metadata-protocol)!: the metadata lists serve nothing a disabled package's customization pair or a dependent's added bundle member carries for it (ADR-0150 D3) - #33405

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/area-E1-32354
Nov 14, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/area-E1-32354

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

Fixes #32354

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — skills/** and content/docs/** teach that a disabled module is hidden (content/docs/deployment/marketplace-handbook.mdx) and never teach a list serving a disabled package's customization or a dependent's addition to its bundle, so no taught sentence moves.

BREAKING (ADR-0087 not-required (no-migration-prescription)): while a package is disabled, the metadata lists no longer serve the rows its customization pair stores for its names, nor a dependent's added bundle member of them. Area-lease pilot #33059, area E1. The list-door remainder of this card: PR #33130 (merged) did the bare, exact and layered reads.

维护者速读

  • 改了什么:某个包停用后,元数据列表不再列出它的定制包(包名.custom)为它的名字存的行,也不再列出依赖它的包给它的邮件模板追加的语言版本。涉及:不指名包的列表及其执行列表、指名停用包的列表、指名其定制包的列表。不指名包的发信读的就是这个执行列表,所以也不再发出这两类内容。
  • 为什么改:专题 ADR-0150 D3「停用的包不持有任何名字」。按名读取早已对这些地址答 404,列表却还按注册和保存顺序列出它们;停用一个包应在每个读门上都消失(epic note 6820147040)。
  • 风险与回滚:只在有包被停用时生效,没有包停用时所有列表与之前完全相同;依赖包自己的地址(?package=DEP)仍列出它追加的语言。过渡期内从依赖包本身发信(读不指名列表)在基础包停用时找不到该语言,等 ADR-0150: the email template send judges the served holders (a disabled package holds no name at the send) #32670 让发信按在用持有者判定后恢复。回滚即 revert 本 PR,不改任何存储数据。
  • 先看:packages/metadata-protocol/src/protocol-meta-list-reads.ts 的 disabledHolderListing(新增谓词,'unscoped' 分支里依赖包追加的判定)以及它在停用过滤处的调用。
  • 两分钟验证:pnpm --filter @objectstack/objectql exec vitest run src/package-scoped-exact-qualifier.test.ts -t 32354,预期 14 例全过。
  • 需要你做的:无,席位落地

What changes

One function, in @objectstack/metadata-protocol's list read (readFlattenedMetaItems), next to the existing disabled-package filter, on the effective and execution faces only (the per-package layer, which the package export reads, keeps a disabled package's items as before):

  • disabledHolderListing(host, type) answers whether an item the list serves at a package is a disabled holder's. It is undefined (nothing moves) for a type the registry does not read by package and while no installed package is disabled.
    • A list scoped to a package serves no name whose exact read at that package is a disabled package's withheld item. The predicate is the exact read's own, disabledExactAddressHolder (protocol-exact-qualifier.ts, unchanged): the package is disabled, or it is a customization pair whose every base holding the name is.
    • The list naming no package leaves out an item whose own package's address is withheld that way (a disabled holder's pair row), and, for a bundle (ITEM_KEY_DISCRIMINATORS), an addition to a disabled holder's bundle: the item's package holds the name only as an addition (the registry's holders read as any other caller leave it out, read as itself keep it) and every holder in its declared dependency closure is disabled. Every holder is read with includeDisabledPackages, so a disable never promotes an addition to a holder.

Moved answers

Measured over a real SchemaRegistry and ObjectStackProtocolImplementation, on 2b2e5b41 (FROM: #33251's head, main plus #32606) and on this branch: A ships welcome in en-US; A's pair A.custom stores a fr-FR row of it, or DEP (depends on A) ships a fr-FR addition; with one holder, or beside B, an enabled second holder of welcome. Both registration orders, the pair row stored before and after the registrations. A disabled:

read FROM TO
getMetaItems / getMetaItemsForExecution, no package (GET /meta/email_template) the pair's fr-FR row, or DEP's fr-FR (beside B's en-US with two holders) neither (B's en-US only with two holders, else nothing)
the same, ?package=A the pair's fr-FR row []
?package=A.custom the pair's fr-FR row not listed
a send naming no package, fr-FR (createRegistryEmailTemplateLoader over the protocol) the pair's row, or DEP's member no template
a send from DEP, fr-FR DEP's member no template (declared; see below)

Not moved. With nothing disabled every list answers as on FROM (CONTROL in every pin). ?package=DEP keeps DEP's fr-FR, as ?package=DEP&member=fr-FR serves it. ?package=B and B's items, the pair's own item of a name A ships nothing of (CONTROL, both orders), the per-package layer, and every by-name read answer as before. Re-enabling A restores every list (asserted in every pin).

Declared interim move. A send from DEP itself resolves to the list naming no package for this name (bundleAddressOf finds one holder), so it no longer finds DEP's fr-FR while A is disabled. #32670 (the send judges the served holders, nested under this card and landing after it) reads such a send at DEP's own address, which keeps the member.

Red lines

  1. Resolution never loosened. Only items leave lists, and only items the by-name read of the same address already withholds. Nothing refused or absent is now served.
  2. Ambiguity reported, never guessed. The answer no longer depends on registration or save order: every pin runs both orders and both save orders, and reads twice after the first read hydrated the stored row.
  3. Independently releasable. No stored row, key or export changes; it moves nothing while no package is disabled, and re-enabling restores every answer.

Tests

  • packages/objectql/src/package-scoped-exact-qualifier.test.ts, top-level [#32354] the list doors serve nothing a disabled holder's pair or dependent carries for it (real registry and protocol, environmentId unset so the list hydrates rows): 12 cases (four states × both registration orders × both save orders for the pair row) asserting seven lists with nothing disabled, A disabled (read twice), and A re-enabled; plus 2 CONTROLs for the pair's own item.
  • packages/rest/src/meta-disabled-package-doors.test.ts, [#32354] RestServer: the list doors and the send naming no package beside a disabled holder (an environment-scoped protocol): GET /meta/email_template unscoped and with package= A, A.custom, DEP through the RestServer route, and the email loader's send with no package and from DEP; 6 cases.

Acceptance notes

Verification

Head 333edb0868 (this branch with origin/main 87330e8959 merged).

Pins and ablations
  • objectql src/package-scoped-exact-qualifier.test.ts -t 32354: 14 passed. REST src/meta-disabled-package-doors.test.ts: 47 passed (the 6 new cases among them).
  • Ablations (source changed with scripts/ablation-replace.mjs, @objectstack/metadata-protocol rebuilt under the verify lock, ablation-dist-preflight saw the marker in dist/, then restored: git diff HEAD empty, rebuilt, marker --absent exit 0):
    • A1, the exact-address arm off (disabledExactAddressHolder never withholds): objectql 8 failed (every pair-row case: one and two holders, both orders, both save orders), 6 passed (the four addition cases and both CONTROLs); REST 4 failed (every pair-row case), 43 passed.
    • A2, the addition arm off (bases.every(disabled) never true): objectql 4 failed (every addition case), 10 passed; REST 2 failed (both addition cases), 45 passed.
    • A first A2 attempt never reached the lock (queue-timeout), so the preflight refused (marker absent from dist/) and its green run was discarded; the rerun above is the leg.
Package tests, typecheck, lint
  • turbo run test --concurrency=2 --continue over the affected set against main (82 packages, @objectstack/dogfood left to its own battery), under the verify lock: stopped on the area lead's order once it held the lock too long, after 68 packages had finished, with 0 failed test files. Among them @objectstack/metadata-protocol 339 files passed (9 skipped), @objectstack/objectql 595, @objectstack/rest 410, @objectstack/runtime 599, @objectstack/cli 637 (2 skipped), @objectstack/plugin-email 53. The rest of the set (UI packages) is CI's Test Core.
  • pnpm --filter metadata-protocol, objectql, rest run typecheck: exit 0 (VERDICT command-exit 0).
  • pnpm lint: exit 0.
  • NOT MEASURED locally: the full dogfood battery (owed by the (narrowing) arm; not run, because the shared lock was the bottleneck and the area lead asked for the narrowed pre-push set; the queue's Dogfood Regression Gate runs it), and the derived gate families (CI's Lint & Repo Gates).

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn

… the name is never another package's moved edit (ADR-0150 D4)
…s the name at a bundle addition; changesets and ADR-0087 entry
…air row and a dependent's addition to its bundle (ADR-0150 D3)

Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
Co-authored-by: Claude <noreply@anthropic.com>
…w and a dependent's addition, both orders

Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
Co-Authored-By: Claude <noreply@anthropic.com>
… a disabled holder; changeset

Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

2 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 2797f81db7f78d0197f007b7ba502b5816e518c1 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 06cacce13b5a2ff1292d24f2722a07d23ee0c195 — the merge of head a785894002a5362576dce88bfac41ceaad4a767a into base 2797f81db7f78d0197f007b7ba502b5816e518c1, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 06cacce13b5a2ff1292d24f2722a07d23ee0c195 && git checkout 06cacce13b5a2ff1292d24f2722a07d23ee0c195
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 2797f81db7f78d0197f007b7ba502b5816e518c1 a785894002a5362576dce88bfac41ceaad4a767a && git checkout -B drift-repro 2797f81db7f78d0197f007b7ba502b5816e518c1 && git merge --no-ff a785894002a5362576dce88bfac41ceaad4a767a

node scripts/docs-audit/affected-docs.mjs --json 2797f81db7f78d0197f007b7ba502b5816e518c1

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cy1y7UNVbT2QAdmgdn

Request: review · area E1 · head 333edb0 · 2026-11-14T18:54Z

Fixes #32354 (ADR-0150 D3, list doors): the metadata lists serve nothing a disabled package's customization pair or a dependent's added bundle member carries for it. Declares a narrowing (BREAKING); the dependent's own send losing its added locale while the base is disabled is declared and restored by #33385 / #32670. Local dogfood not measured (verify lock); the merge queue's dogfood shards run it. Reviewer: review#1.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4cwxS1ZpSu2hAMRcqbt · head 333edb0 · 2026-11-14T18:55Z

review#1 (E1) takes this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 333edb086831ca104cb791040018ee46a5ba7809
Local-runs: none
Scope: packages/metadata-protocol/src/protocol-meta-list-reads.ts, packages/objectql/src/package-scoped-exact-qualifier.test.ts, packages/rest/src/meta-disabled-package-doors.test.ts, .changeset/32354-list-doors-disabled-holder.md + packages/metadata-protocol/src/protocol-exact-qualifier.ts (disabledExactAddressHolder, read), @objectstack/metadata-core packageDependencyClosure (read)

Face: narrowing (Clause-②: no (narrowing) on the changeset), with no hits; the whole non-prose diff is in scope. Diff read against merge base 87330e89.

① Derived judgments

  • disabledHolderListing returns undefined, so no list moves, unless the registry can answer and some package is disabled. When it acts, it filters after isItemOfDisabledPackage on the effective and execution lists only. keepDisabledPackages (the package export) and type: package are untouched.
  • Scoped list ('address'): a name is dropped exactly when disabledExactAddressHolder withholds it at that package, the same predicate as the exact read. So ?package=A and ?package=A.custom agree with their 404s, and ?package=DEP keeps its addition (DEP is neither disabled nor a pair).
  • Unscoped list ('unscoped'): an item is dropped when its own bound package's address is withheld (a disabled holder's pair row), or, for a bundle type, when its package is an addition-only holder whose every base in its declared dependency closure is disabled. Holders are read with includeDisabledPackages, so a disable never promotes an addition to a holder. Items with no binding are kept. Answers are memoised per call.
  • Pins: the objectql cases × both registration orders × row saved first or last, with a nothing-disabled CONTROL and the pair's own item of a name A ships nothing of (kept). REST covers the pair's row in four orders, the dependent's addition, and the send naming no package, each with a re-enable CONTROL.
  • CI on this head was still running at review time (12 success, 16 skipped, 20 in progress, none failed). Landing needs all checks green, and the head will move when fix(metadata-protocol)!: the read naming no package withholds a customization pair's row of a name every holder of which is disabled (ADR-0150 D3) #33383 lands (shared test files), which needs a delta record.

② Semver level

Clause-②: no (narrowing), the same arm as #33383 for the by-name read and the right one: nothing an author writes or a caller sends is newly accepted, and lists answer less. (The hand-off message said yes (narrowing); the committed changeset says no (narrowing), which governs.) Metadata-protocol: none, for the same reason ruled on #33383 (record 6882490650). @objectstack/metadata-protocol is patch with the BREAKING banner.

③ Boundary flags

④ Design judgment

The narrowing, judged against the published spec and ADR-0150 D3 on main: a disabled package holds no name, and the by-name doors already withhold what it carries. The lists serving it depended on registration and save order, which contradicted the exact reads. This PR makes the list doors use the exact read's own predicate, so it makes the spec's refusal real rather than taking away a declared capability. The dependent's own address still serves its addition, so nothing a dependent ships becomes unreachable. No must-fix or should-fix; N1–N2 are nits. This is the final round.

Implemented-by: claude/area-E1-32354
Reviewed-by: session_016WV4cwxS1ZpSu2hAMRcqbt

VERDICT: PASS

# Conflicts:
#	packages/objectql/src/package-scoped-exact-qualifier.test.ts
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: a785894002a5362576dce88bfac41ceaad4a767a
Local-runs: none
Scope: packages/metadata-protocol/src/protocol-meta-list-reads.ts, packages/objectql/src/package-scoped-exact-qualifier.test.ts, packages/rest/src/meta-disabled-package-doors.test.ts, .changeset/32354-list-doors-disabled-holder.md + the merge resolution of packages/objectql/src/package-scoped-exact-qualifier.test.ts

Delta of record 6882605735 (PASS on 333edb086831ca104cb791040018ee46a5ba7809). This head merges main at 2797f81d, which carries #33383, and resolves one conflict. Per the pilot rule, only the resolution is reviewed.

① Derived judgments

② Semver level

Unchanged from record 6882605735: Clause-②: no (narrowing), Metadata-protocol: none, patch, adr-0087: not-required.

③ Boundary flags

Unchanged. N1–N2 of record 6882605735 stand as nits.

④ Design judgment

Unchanged. The PR's own source hunks are byte-identical by patch id, and the resolution only places two independent test blocks side by side. Record 6882605735's judgment carries to this head.

Implemented-by: claude/area-E1-32354
Reviewed-by: session_016WV4cwxS1ZpSu2hAMRcqbt

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cy1y7UNVbT2QAdmgdn

ACCEPT · area E1 · 2026-11-14T21:03Z

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 14, 2026 21:05
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 3269cab Nov 14, 2026
52 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-E1-32354 branch November 14, 2026 22:08
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…n, and the boot load joins the hydration-state pins (objectstack-ai#33483)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDwkEEJd65kqFZGFjQnzBQt)_

Fixes objectstack-ai#32716

Clause-②: yes (narrowing)
Metadata-protocol: none

**BREAKING** for a TypeScript caller that narrows `type` to
`PackageScopedType` through the exported
`judgesPackageLessRows(registry, type)` (for example `if
(judgesPackageLessRows(r, t)) useScoped(t)`): its return type is now
`boolean`, so that call no longer compiles. Call
`isPackageScopedType(type)` from `@objectstack/core` first. The runtime
answer is unchanged; the level stays patch.

<!-- adr-0087: not-required (no-migration-prescription) no key of any
schema is added, removed, renamed or re-shaped and no stored row changes
shape: what moves is one exported function's TypeScript return type -->

## 维护者速读

- 改了什么:① `judgesPackageLessRows` 的返回类型由类型谓词改为普通
`boolean`,运行时答案不变;`packageLessRowOwners` 改用 `isPackageScopedType` 收窄类型。②
N3 实测:按包精确读一条包外 action
存储行,在载入前后(启动加载、列表读、裸槽副本)答案一致,都是持有者自己的条目,所以不改代码,只把「启动加载」补进现有的载入状态 pin。
- 为什么改:① 谓词会让调用方的 false 分支被收窄成 never,但 false 其实取决于注册表。② 卡片说的「载入前 200、载入后
409」在当前 main 上已不存在(objectstack-ai#32568 的裁决已经处理),这里实测确认并钉住启动加载这一路。
- 风险与回滚:仅类型签名与测试;无读答案变化。回滚 = revert 本 PR。
-
先看:`packages/metadata-protocol/src/protocol-exact-qualifier.ts`(`judgesPackageLessRows`
签名与 `packageLessRowOwners`
首行);`packages/objectql/src/package-scoped-exact-qualifier.test.ts` 的
location 4 `STATES`。
- 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run
src/package-scoped-exact-qualifier.test.ts -t "location 4"`,预期全部通过,含新增的
`after the boot load` 用例。
- 需要你做的:无,席位落地。

## What changes

1. **N1.** `judgesPackageLessRows(registry, type)` returned the type
predicate `type is PackageScopedType`. Its `false` depends on the
registry (`readsByPackage`), so the predicate narrowed a package-scoped
type to `never` in a caller's `false` branch. It now returns `boolean`.
One caller relied on the predicate: `packageLessRowOwners` passed the
narrowed `type` to `isPlatformRequestedBareName`. It now narrows through
`isPackageScopedType`, which depends on the type alone. The CLI caller
(`stored-package-references.ts`, a `filter`) typechecks unchanged. The
runtime answer is unchanged.
2. **N3, measured: the answers are the same, so no read moves.** A
stored package-less `action` row of a name a package ships was read at
the holder's exact address (`?package=`) and in the layered read. It was
read before and after each hydration path: the boot load
(`loadMetaFromDb`), the list read's hydrator (`getMetaItems`), and a
copy in the registry's bare slot stamped `''` or `sys_metadata`. Each
path was run with one holder and with two holders in both registration
orders. The answer was the holder's own item every time (200), and the
layered read reported no overlay. The card's 200-before / 409-after
premise came from before the epic ruling 6817768147 on objectstack-ai#32568. That
ruling's change makes the hydrator decline the row
(`hydrateOverlayIntoRegistry`) and makes the exact read replace a
bare-slot copy (`declinedCopyReplaced`). The list read and the bare-slot
copies were already pinned (location 4 of `[objectstack-ai#32568]`). The boot load was
not, so this PR adds it to those pins for `action`, `queue` and `tool`,
with one holder and two.

No ADR-0150 D4 ruling is needed for N3: nothing differs, so nothing is
implemented beyond the pins.

## Tests

- `packages/metadata-protocol/src/protocol-exact-qualifier.test.ts`: a
new case, `[objectstack-ai#32716 N1]`. It is checked by `tsc`, and the package's
`typecheck` compiles the file (`tsc --listFiles` lists it). In the
`false` branch, a `hook` typed `PackageScopedType` keeps that type.
- `packages/objectql/src/package-scoped-exact-qualifier.test.ts`,
location 4: a new state, `after the boot load`, in both registration
orders × `action`/`queue`/`tool` (6 new cases). The one-holder case now
walks before → after the boot load → after the read-side hydrator. The
boot-load leg asserts the load reached the row (`loaded: 1, errors: 0`),
so the pin cannot pass without a load.

All runs on head `4bb529d89` (the merge of `origin/main` 0c2aeb9 into
the branch), through `scripts/pm/os-verify-lock.sh`:

<details><summary>Unit and package runs</summary>

- `pnpm --filter @objectstack/metadata-protocol typecheck` → exit 0;
`pnpm --filter @objectstack/metadata-protocol test` → Test Files 340
passed, 9 skipped (349); Tests 22866 passed, 43 skipped. VERDICT
command-exit 0.
- `pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2
src/package-scoped-exact-qualifier.test.ts` → Tests 294 passed (294).
Before the change the file held 288; the 6 new cases are the boot-load
state.
- `pnpm --filter @objectstack/cli typecheck` (after building its
dependency closure, which included the new `.d.ts`) → exit 0, and
`check:test-typecheck` OK. This is the one other caller of
`judgesPackageLessRows`.
- `objectql` is a tests-only touch here: its full suite and the
`integration` layers are left to CI (`Test Core`).

</details>

<details><summary>Ablations (one-shot; nothing left in the
tree)</summary>

- **N1.** Ran `scripts/ablation-replace.mjs` on
`protocol-exact-qualifier.ts`, replacing the anchor `type: string):
boolean {` with the predicate `type is
import('@objectstack/core').PackageScopedType`. The anchor went x1 to x0
and the blob changed. `typecheck` then went RED, with one error at the
new pin: `protocol-exact-qualifier.test.ts(98,42): error TS2344 ...
Actual: never`. The file was restored to blob == HEAD and `git diff
HEAD` came back empty.
- **N3 boot-load pin.** The hydrator's decline branch in
`protocol-registry-hydration.ts` (`if (scoped && canonicalType !==
'flow' && !options.packageId && host.declinesStoredRow(`) was put behind
an always-false guard. The rebuilt `dist/` was proven to carry the
marker (`ablation-dist-preflight`). Location 4 then went RED, 6 failed:
`after the boot load exact: expected 'stored' to be 'alpha action'`, the
same for `queue` and `tool`, plus the pre-existing disabled-holder
cases. After the restore, the rebuild was proven free of the marker
(`--absent`), and the file is back to 294 passed.

</details>

<details><summary>N3 measurement on main (ba35dfd with only the
type-only N1 edit on top; a throwaway describe, not committed)</summary>

The stored package-less `action` row is `approve`, and A and B are the
shipping packages. Below, "own" means the holder's own item, and
"layered own" means the layered read reported no overlay and its
effective item was the holder's own.

| holders | hydration | `?package=A` before / after | `?package=B`
before / after | layered before / after |
|---|---|---|---|---|
| A | boot load | 200 own / 200 own | 409 not held / 409 not held | own
/ own |
| A | list read | 200 own / 200 own | 409 / 409 | own / own |
| A | bare copy `''`, `sys_metadata` | 200 own / 200 own | 409 / 409 |
own / own |
| A+B, B+A | boot load | 200 own / 200 own | 200 own / 200 own | own /
own |
| A+B, B+A | list read | 200 own / 200 own | 200 own / 200 own | own /
own |
| A+B, B+A | bare copy `''`, `sys_metadata` | 200 own / 200 own | 200
own / 200 own | own / own |

The boot load reported `{loaded:1, errors:0}` and left the holder's slot
holding the holder's own item. A boot load run before the package
registers, and then the package, also gives 200 own at each holder's
exact address.

</details>


## Acceptance notes

- **Clause-② reading.** First declared `no`; review#3's contract record
(6885158237) ruled the exported return type public surface, so a caller
narrowing through the predicate's `true` branch stops compiling: `yes
(narrowing)`, `!` title, BREAKING paragraph, one ADR-0087 not-required
marker (same reading as review#1 on objectstack-ai#33121). Delta head 82cc3c1 changes
only the changeset and this body.
- **Not in scope, harness observation only, not filed.** In the same
harness, a bare read naming no package with a bare-slot copy in place
answers differently from the exact read. With one holder it serves the
copy; with two it is refused naming "3 holders". The exact read serves
the holder's own in both cases. The bare-slot copy is a hand-registered
state: the hydrator no longer produces it, and the heal walk is said to
remove a pre-install copy. This harness registers packages without that
walk, so no public door was measured. `reach:` none measured.
- E1's open PR objectstack-ai#33405 edits the same objectql test file at a different
hunk (after line 2529); this PR's hunk is at location 4 (lines
2228–2270).

## Verification

Derived gate families (`node scripts/pm/dispatch-gates.mjs --commands`,
from the tree at the merge head `4bb529d89`): 64 commands. Each was run,
and its exit code was captured before any pipe:

- **63 exit 0.** These include `check:changeset-no-major`,
`check:adr-0087-registration`, `check:empty-changeset`,
`check:closing-keyword-parity`, `check:nul-bytes`,
`check:test-source-alias`, `check:cross-package-test-inputs`,
`check:type-check-coverage`, `check:type-check-debt`,
`check:durability-log-level`, `check:engine-double-contract`,
`check:published-files`, `check:dts-closure`, `check:doc-authoring` and
`check:issue-citations`.
- **1 NOT MEASURED:** `pnpm check:dual-build-cjs-loads`, exit 3,
`PREREQUISITE NOT MET`. It reads every package's `dist/`, and this
worktree did not build the whole repo. CI carries it.
- **Reconciliation:** `dispatch-gates --ran` with the exit codes
recorded: 64 derived, 63 run, 1 NOT-MEASURED (derived from the recorded
exit 3), 0 UNRUN.
- **Lint:** `eslint --no-inline-config` on the three changed `.ts` files
gives exit 0. The repo-wide `pnpm lint` is CI's.
- No symbol was renamed or removed, so `check-platform-checklist
--changed-from` does not apply.
- The full farm, dogfood and the `integration` layers are CI's. The
title carries no `!` and there is no `(narrowing)` arm, so no dogfood
battery is owed.


Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- signed: domain:server#5 · os-elon-musk ·
session_016WV4cz4f7zEQZ2C9GTG382 -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…s what it sends when only the enabled one holds it (objectstack-ai#33678)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9D3DpgJLtDkE1fR76z3bz5Xm)_

Part of objectstack-ai#32670

Clause-②: no
Metadata-protocol: none

The card stays open: its `_env` half is objectstack-ai#33385 (area E1, still open).
This PR is the "separate, declared move" that objectstack-ai#33361's acceptance notes
and its contract review (record 6882047833, item ③) left owed once
objectstack-ai#32354 landed. objectstack-ai#32354 landed in objectstack-ai#33405 (merged 2026-11-14T22:08Z, before
objectstack-ai#33361).

## 维护者速读

-
改了什么:邮件模板名有一个持有包被停用、只剩一个在服务的持有包时,发送(经元数据协议的执行列表)改为读环境级列表,与"只有这一个包持有该名"时完全一致;另把
`servedBundleAddressOf` 中不可达的环境项分支改为"找不到模板"(复审 nit N1)。
- 为什么改:ADR-0150
D3「停用的包不持有任何名字」。objectstack-ai#32354(objectstack-ai#33405)落地后,环境级列表已不再列出停用包一侧的成员(自身项、定制对行、依赖包追加的语言),所以地址可以只按在服务持有包数量来选;此前读该包自己的地址,会漏掉依赖它的包追加的语言。
-
风险与回滚:只在有持有包被停用、且只剩一个在服务持有包时生效。实测唯一变化:该持有包的定制对行与依赖包追加语言落在同一语言时,答案从定制对行变为依赖包的语言,与停用包根本不持有该名时的答案相同。没有包停用时、或无协议只读注册表时,答案不变。回滚即
revert 本 PR。
- 先看:`packages/plugins/plugin-email/src/template-loader.ts` 的
`servedBundleAddressOf`(`onServedCount` 与 `servedCountDecides` 参数)以及
`readBundle` 中 `viaProtocol` 的传入;`template-loader.test.ts` 中 `two
holders, BETA disabled` 一例的期望与新的 `one holder` CONTROL。
- 两分钟验证:`pnpm --filter @objectstack/plugin-email exec vitest run
src/template-loader.test.ts`,预期 80 个测试全部通过。
- 需要你做的:无,席位落地

## What changes

`packages/plugins/plugin-email/src/template-loader.ts`,
`servedBundleAddressOf` (the branch taken only while a holder of the
name is disabled):

- **The address is chosen on the served count when the bundle is read
from the protocol's execution list.** One served holder ⇒ the
environment-wide list (`undefined`), two or more ⇒ the answering
holder's own address, exactly as `bundleAddressOf` chooses on the holder
count when nothing is disabled. This applies to both answers that read a
package's bundle: the name resolving to a served holder, and the closure
re-resolve (a caller holding an addition only, or the built-ins for an
`auth.*` name).
- **Why it is safe now:** since objectstack-ai#33405 (objectstack-ai#32354) the environment-wide
execution list holds no member of a disabled holder's side: its own
items were already filtered, and the list naming no package now
withholds its customization pair's rows and a dependent's added bundle
members. So the read beside a disabled holder answers what it answers
when that holder holds nothing of the name.
- **The registry's own list keeps the per-holder address.**
`registry.listItems` (read only when no protocol is registered)
withholds neither, so there the move would leak a dependent's addition
to the disabled holder (measured, see the second ablation). `readBundle`
passes `viaProtocol` into `bundleAddressOf` as `servedCountDecides`.
- **Nit N1:** the environment-item branch (`resolved.holder.kind` other
than `package`) now answers `NO_BUNDLE` instead of the environment-wide
read. It is unreachable while a holder is disabled (a name a package
holds resolves to no environment item), so no answer moves; "no read is
made beside a disabled holder for it" now holds by construction.
- Doc comments on `bundleAddressOf` and `servedBundleAddressOf` restate
the rule. Changeset: `@objectstack/plugin-email` patch.

### Moved answers

Probe: the objectstack-ai#33361 world (a real `SchemaRegistry` and the protocol's real
`getMetaItemsForExecution` over stored rows), 8 disabled states × 2
registration orders × 2 reads × 9 callers × 2 locales = 1,152 answers,
on `babd5d4a` (FROM, `main`) and on this branch (TO), plus the same
worlds with the disabled package's side removed instead of disabled
(ABSENT: it ships nothing of the name; for ALPHA also no pair row and no
dependent's addition).

| Read | State | Caller | Locale | FROM | TO | ABSENT |
|:--|:--|:--|:--|:--|:--|:--|
| protocol | two holders, BETA disabled (ALPHA carries a pair row and a
dependent's addition, both fr-FR) | omitted, null, ALPHA, BOTH,
VIA_ALPHA, ADDER | fr-FR | the pair's row (`PAIR fr-FR`) | the
dependent's addition (`ADDER fr-FR`) | `ADDER fr-FR` |

12 answers move (6 callers × 2 orders), all toward the ABSENT answer; 0
of the 1,152 move away from it. The answers that still differ from
ABSENT number 204 (216 on FROM), and every one is a declared row of
objectstack-ai#33361: the disabled package's own send (row 36), the environment's item
or a package-less stored row beside a name only a disabled package holds
(row 37), and the registry-only read (below). With nothing disabled the
code path is unchanged (`bundleAddressOf`'s first branch), and the
pinned CONTROLs hold.

## Tests

`packages/plugins/plugin-email/src/template-loader.test.ts`, describe `a
disabled package holds no name at the send (ADR-0150 D3, objectstack-ai#32670)`:

- The `two holders, BETA disabled` case's protocol expectations move
fr-FR from `PAIR fr-FR` to `ADDER fr-FR` for the six callers above (its
registry-read override is unchanged: `no template`).
- A new CONTROL, state `one holder` (ALPHA alone holds the name, nothing
disabled), pins the answers the BETA-disabled case must equal for every
caller but BETA itself. 1 case × 2 orders × 2 reads = 4 new tests; the
file runs 80 (76 on `main`).

## Acceptance notes

- **The registry-only read keeps a disabled-vs-absent difference.** With
no protocol registered and BETA disabled, a fr-FR send for ALPHA's
callers answers `no template` (ALPHA's own address, which the registry
list narrows by `_packageId`), where ABSENT answers `ADDER fr-FR`. The
move cannot be applied there because `registry.listItems` still lists a
dependent's addition to a disabled holder (ablation 2 measures the
leak). A host with no protocol has no metadata door; noted, not filed.
- **The moved answer prefers the dependent's addition over the holder's
pair row at the same locale.** That is `main`'s answer for a name one
package holds with nothing disabled (the new CONTROL, both orders, and
objectstack-ai#33361's R4-F note), not a rule this PR adds: the move only makes the
disabled case equal to it.
- **Not in this PR:** the `_env` cell of objectstack-ai#32183 row 17 (objectstack-ai#33385, area E1,
`packages/metadata-protocol/src/**`) and the R4-G flow doors, as objectstack-ai#33361
recorded. So `Part of objectstack-ai#32670`, not a closing line.
- The probe files were temporary and are not committed.

## Verification

Read at `7612a59d` (the change). The head `9754555c` adds one merge of
`origin/main` (`dd291b83` era, no conflict); the incoming commits touch
no file of `plugin-email` and nothing in the list reads or the
package-scoped resolver the loader calls (they change `objectql`
engine-update, search and validation files and `metadata-protocol`'s
seed loader and registry question), so the readings below are not re-run
on the merge; CI reads the head.

<details><summary>Tests, typecheck and lint (plugin-email), at
7612a59</summary>

```
pnpm --filter @objectstack/plugin-email test       Test Files 53 passed (53) · Tests 1018 passed (1018)
pnpm --filter @objectstack/plugin-email typecheck  exit 0 · check:test-typecheck OK (0 errors)
pnpm exec eslint (the two changed source files)    exit 0
os-verify-lock: VERDICT command-exit 0
```
</details>

<details><summary>Ablation 1: the pins against main's loader
(template-loader.ts restored from babd5d4)</summary>

```
on-disk mutation: servedCountDecides count=0 (HEAD has 6)
× read: protocol > registered as listed > two holders, BETA disabled
× read: protocol > registered reversed  > two holders, BETA disabled
Tests 2 failed | 78 passed (80)          VERDICT command-exit 1
restored: git checkout HEAD -- the file; blob hash equals HEAD's; git status clean
```
</details>

<details><summary>Ablation 2: the move forced onto the registry read
(servedCountDecides passed as true)</summary>

```
anchor before: 1 · after: 0 · injected: 1
× read: registry > two holders, ALPHA disabled            (both orders: ADDER fr-FR leaks)
× read: registry > two holders, BETA disabled             (both orders)
× read: registry > an auth name one package overrides, ALPHA disabled (both orders: ADDER fr-FR leaks)
Tests 6 failed | 74 passed (80)          VERDICT command-exit 1
restored: blob hash equals HEAD's; git status clean
```
</details>

<details><summary>Gate families</summary>

Derived with `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at 7612a59 (64 commands), each run locally
with its exit code captured before any pipe:

```
61 of 64 exit 0 (check-adr-0087-registration, check-changeset-no-major, check-empty-changeset,
  check-issue-citations, check:engine-double-contract, check:test-source-alias,
  check:registry-log-declared, check:cross-package-test-inputs, check:nul-bytes,
  check:published-files, check:type-check-coverage, the comment-mask corpus and the rest)
NOT MEASURED, 3 (prerequisites of this checkout, not readings of the diff; CI runs each):
  check-plugin-teardown-shape --self-test   exit 3: shallow clone, positive control commit unreachable
  check:dual-build-cjs-loads                exit 3: PREREQUISITE NOT MET, reads every package's dist/
  check:type-check-debt                     exit 3 under the 4096 MB heap cap; re-run uncapped, it
                                            began a whole-closure build under the shared lock, stopped (not read)
```
</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cx5ZPCyTk8ckTsx4ut)_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants